﻿using System.Collections.Generic;
using com.guojin.core.io;
using com.guojin.core.io.message;

namespace com.guojin.mj.net.message.game
{
    public class 
        ChapterInfoRet : Message
    {
        public static int TYPE = 12;
        public static int ID = 9;

        public int state { get; set; }
        public int zhuangLocationIndex { get; set; }
        public List<UserChapterInfoRet> userChapterInfo { get; set; }

        public void decode(Input _in)
        {
            state = _in.readInt();
            zhuangLocationIndex = _in.readInt();
            int len = _in.readInt();
            if (len == -1)
            {
                return;
            }
            userChapterInfo = new List<UserChapterInfoRet>();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    UserChapterInfoRet ur = new UserChapterInfoRet();
                    ur.decode(_in);
                    userChapterInfo.Add(ur);
                }
            } 
        }

        public void encode(Output _out)
        {
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return string.Format("ChapterInfoRet[state={0}" , state);
        }
    }
}